<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>VERIFY NUM</title>
		<script type="text/javascript" language="javascript">
			window.onload = function() {
				document.getElementById("d1").onblur = function() {
					var regexp = /^\d+$/;
					var eleText = document.getElementById("d1");
					var value = eleText.value;
					if (!regexp.test(value)) {
						document.getElementById("msg1").textContent = "F";
						return false;
					}else{
						document.getElementById("msg1").textContent = "T";
						return true;
					}
				};
				document.getElementById("d2").onblur = function() {
		
					var regexp = /^\d+$/;
					var eleText = document.getElementById("d2");
					var value = eleText.value;
					if (!regexp.test(value)) {
						document.getElementById("msg2").textContent = "F";
						return false;
					}else{
						document.getElementById("msg2").textContent = "T";
						return true;
					}
				};
				document.getElementById("form").onsubmit = function() {
					var eleForm = document.getElementById("form");
					var regexp = /^\d+$/;
					var d1 = eleForm.d1.value;
					var d2 = eleForm.d2.value;
					if (!regexp.test(d1)) {
						document.getElementById("msg").textContent = "please put in num";
						return false;
					}
					if (!regexp.test(d2)) {
						document.getElementById("msg").textContent = "please put in num";
						return false;
					}
					return true;
				};
			};
		</script>
	</head>
	<body>
		<a href="/test/index.jsp">首页</a>
		<hr color="red" />
		<label style="color: blue">Put in any Num</label>
		<form id="form" action="#">
			<input type="text" id="d1" name="d1" />
				<label id="msg1" style="color:red "></label><br>
			<input type="text" id="d2" name="d2" />
				<label id="msg2" style="color: red"></label><br> 
			<input type="submit" value="submit" />
		</form>
		<br>
		<label id="msg" style="color: red"></label>
	</body>
</html>




